package com.rui.service.impl;

import com.rui.dao.StudentDao;
import com.rui.entity.Student;
import com.rui.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/4/12.
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;

    public void add(Student student) {
        studentDao.add(student);
    }

    public void delete(Integer id) {
        studentDao.delete(id);
    }

    public void update(Student student) {
        studentDao.update(student);
    }

    public Student findOne(Integer id) {
        return studentDao.findOne(id);
    }

    public List<Student> findStudents(String realName, Integer pageSize, Integer pageIndex) {
        return studentDao.findStudents(realName,pageSize,pageIndex);
    }

    public Integer findTotalPage(String realName, Integer pageSize) {
        return studentDao.findTotalPage(realName,pageSize);
    }

    public Student findByUserName(String userName) {
        return studentDao.findByUserName(userName);
    }

    public List<Student> findStudents(String userName, Integer id) {
        return studentDao.findStudents(userName,id);
    }
}